<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <!--  相对路径，相对于当前文件所在路径  -->
    <script src="js/axios.js"></script>
    <!-- 绝对路径，/项目名开头   -->
    <script src="/day3_02/js/vue.js"></script>
</head>
<body>
<div id="app">
    <input placeholder="用户名" v-model="user" ><br>
    <input type="password" v-model="pass"><br>
    <input type="button" value="登录" @click="login">
</div>
<script>
    new Vue({
        el:"#app",
        data:{
            user:'',
            pass:''
        },
        methods:{
            login(){
                var p=new URLSearchParams();
                p.append('user',this.user);
                p.append('pass',this.pass);
                axios.post('http://localhost/day3_02/login',p).then(ret=> {
                    alert(ret.data);
                    location.href="http://localhost/day3_02/success.html"
                });
            }
        }
    });
</script>
</body>
</html>